<?php

/**
 * Proveedor form base class.
 *
 * @method Proveedor getObject() Returns the current form's model object
 *
 * @package    cronos-doctrine
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseProveedorForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                => new sfWidgetFormInputHidden(),
      'empresa_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Empresa'), 'add_empty' => false)),
      'pais_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Pais'), 'add_empty' => false)),
      'entidad_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Entidad'), 'add_empty' => false)),
      'municipio_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Municipio'), 'add_empty' => false)),
      'parroquia_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Parroquia'), 'add_empty' => false)),
      'rif'               => new sfWidgetFormInputText(),
      'nombre_proveedor'  => new sfWidgetFormInputText(),
      'direccion_fiscal'  => new sfWidgetFormInputText(),
      'direccion_fisica'  => new sfWidgetFormInputText(),
      'telefono1'         => new sfWidgetFormInputText(),
      'telefono2'         => new sfWidgetFormInputText(),
      'email'             => new sfWidgetFormInputText(),
      'contacto_nombre'   => new sfWidgetFormInputText(),
      'contacto_telefono' => new sfWidgetFormInputText(),
      'created_at'        => new sfWidgetFormDateTime(),
      'updated_at'        => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'empresa_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Empresa'), 'required' => false)),
      'pais_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Pais'))),
      'entidad_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Entidad'), 'required' => false)),
      'municipio_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Municipio'))),
      'parroquia_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Parroquia'))),
      'rif'               => new sfValidatorString(array('max_length' => 25)),
      'nombre_proveedor'  => new sfValidatorString(array('max_length' => 40)),
      'direccion_fiscal'  => new sfValidatorString(array('max_length' => 100)),
      'direccion_fisica'  => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'telefono1'         => new sfValidatorInteger(array('required' => false)),
      'telefono2'         => new sfValidatorInteger(array('required' => false)),
      'email'             => new sfValidatorString(array('max_length' => 40, 'required' => false)),
      'contacto_nombre'   => new sfValidatorString(array('max_length' => 30, 'required' => false)),
      'contacto_telefono' => new sfValidatorInteger(array('required' => false)),
      'created_at'        => new sfValidatorDateTime(),
      'updated_at'        => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('proveedor[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Proveedor';
  }

}
